<template>
  <el-timeline>
    <el-timeline-item v-for="(value, idx) in sessionMsgList" :key="idx" :timestamp="value.time" placement="top">
      <el-card>
        <!--            <div v-if="value.msg_type==='session_init'">{{ value.msg_str }}</div>-->
        <!--            <div v-if="value.msg_type==='git_pull_start'">{{ value.msg_str }}</div>-->
        <!--            <div v-if="value.msg_type==='git_pull_end'">{{ value.msg_str }}</div>-->
        <!--            <div v-if="value.msg_type==='git_pull_end'">{{ value.msg_log }}</div>-->
        <div>{{ value.msg_str }}</div>
      </el-card>
    </el-timeline-item>
  </el-timeline>
</template>

<script>
import axios from 'axios'

export default {
  name: "sessionLogManage",
  props: {
    sessionToken: String
  },
  data() {
    return {
      sessionMsgList: [],
    }
  },
  methods: {
    get_session_msg() {
      let obj_this = this
      let data = {
        "session_token": obj_this.sessionToken,
        "session_msg_tag": obj_this.sessionMsgTag,
      }
      axios.post('/load_session_msg', data).then(function (response) {
        obj_this.sessionMsgList = response.data.msg_list
        obj_this.sessionMsgTag = response.data.session_msg_tag
        obj_this.sessionName = response.data.session_name
        document.title = "CVE修复-" + response.data.session_name
        // console.log(obj_this.sessionMsgList)
      }).catch(function (error) { // 请求失败处理
        console.log(error);
      });
    },
  },
  created() {
    let obj_this = this
    setInterval(() => {
      obj_this.get_session_msg()
    }, 1000)
  }
}
</script>

<style scoped>

</style>